﻿namespace ChinaUnicom.Parser.Parsers
{
    using ChinaUnicom.Models;
    using Avatar;
    using System.Net;

    internal static class Extensions
    {
        static char[] TrimChars = new[] { ' ', '\r', '\t', '\n', '：', ':' };

        public static string InnerTextTrim(this string innerText)
        {
            if (innerText.IsNullOrEmpty())
            {
                return string.Empty;
            }

            return HttpUtility.HtmlDecode(innerText).Trim(TrimChars).Replace("：", string.Empty);
        }

        public static string InnerValueTrim(this string innerText)
        {
            if (innerText.IsNullOrEmpty())
            {
                return string.Empty;
            }

            return HttpUtility.HtmlDecode(innerText).Trim(TrimChars);
        }
    }
}
